//
//  DemoMenuMoreViewController.m
//  DemoMenuMore
//
//  Created by 唐可雄 on 16/5/9.
//  Copyright © 2016年 swustyc. All rights reserved.
//

#import "DemoMenuMoreViewController.h"

#import "YCPopUpMenu.h"

@interface DemoMenuMoreViewController ()

@end

@implementation DemoMenuMoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
}

#pragma mark - Event Response

- (IBAction)menuBtnDidClick:(id)sender {
    UIButton *btn = sender;
    
    YCPopUpMenuItem *item1 = [YCPopUpMenuItem menuItem:@"试试" image:[UIImage imageNamed:@"action_icon"] target:self action:nil];
    YCPopUpMenuItem *item2 = [YCPopUpMenuItem menuItem:@"试试11" image:[UIImage imageNamed:@"action_icon"] target:self action:nil];
    YCPopUpMenuItem *item3 = [YCPopUpMenuItem menuItem:@"试试11" image:[UIImage imageNamed:@"action_icon"] target:self action:nil];
    YCPopUpMenuItem *item4 = [YCPopUpMenuItem menuItem:@"试试11" image:[UIImage imageNamed:@"action_icon"] target:self action:nil];
    YCPopUpMenuItem *item5 = [YCPopUpMenuItem menuItem:@"试试11" image:[UIImage imageNamed:@"action_icon"] target:self action:nil];
    
    YCPopUpMenu *menu = [[YCPopUpMenu alloc] init];
    [menu showFromView:btn menuItems:@[item1, item2, item3, item4, item5, item1, item2, item3, item4, item1, item2, item3]];
}

- (IBAction)menuItemDidClick:(id)sender {
    YCPopUpMenuItem *item1 = [YCPopUpMenuItem menuItem:@"试试" image:nil target:self action:nil];
    
    YCPopUpMenu *menu = [[YCPopUpMenu alloc] init];
    [menu showFromView:self.navigationController.navigationBar.subviews[4] menuItems:@[item1]];
}

- (IBAction)left1BtnDidClick:(id)sender {
    [self menuBtnDidClick:sender];
}

- (IBAction)left2BtnDidClick:(id)sender {
    [self menuBtnDidClick:sender];
}

@end
